/**
 * @Author: Lenovo
 * @Date: 2024/11/7 17:40
 * @description:
 */
class MyRunnable implements Runnable{
    @Override
    public void run() {
        while (true){
            try {
                System.out.println("Hello thread!");
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class Demo02 {
    public static void main(String[] args) throws InterruptedException {
        Runnable runnable = new MyRunnable();
        Thread thread = new Thread(runnable);
        thread.start();
        while (true){
            System.out.println("Hello main!");
            Thread.sleep(1000);
        }
    }
}
